/**
 * 专业列表
 * 可在需要的页面使用this.$store.state.majorList.majorList获取
 */
/**
 * [{
			id: 11,
			name: "软件工程"
		}, {
			id: 22,
			name: "电子信息"
		}, {
			id: 33,
			name: "土木工程"
		}, {
			id: 44,
			name: "软件技术"
		}, {
			id: 55,
			name: "软件工程"
		}, {
			id: 22,
			name: "电子信息"
		}, {
			id: 33,
			name: "土木工程"
		}, {
			id: 44,
			name: "软件技术"
		}, {
			id: 55,
		
			name: "数字媒体"
		}, {
			id: 66,
			name: "游戏设计"
		}, {
			id: 77,
			name: "通信工程"
		}]
 */
export default{
	state: {
		majorList: ""
	},
	mutations:{
		setMajorList(state,majorList){
			state.majorList = majorList;
		}
	},
	actions:{
		//异步请求后台获取专业列表
		getMajorList:({commit})=>{
		    uni.request({
		    	url: 'https://www.tosjw.cn/tsg/major/getMajorList',
		    	success:(res)=>  {
					commit('setMajorList',res.data.data);
		    	},
		    	fail:()=>  {
		    		console.log("获取专业列表失败");
		    	}
		    })  
		}	
	},
	getters:{
		majorList(state){
		    return state.majorList;
		}
	}
}